package org.qpcr.community.web;


import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hswebframework.ezorm.rdb.mapping.defaults.SaveResult;
import org.hswebframework.web.authorization.annotation.Authorize;
import org.hswebframework.web.authorization.annotation.Resource;
import org.hswebframework.web.authorization.annotation.SaveAction;
import org.hswebframework.web.crud.web.reactive.ReactiveServiceCrudController;
import org.qpcr.community.entity.LogMessageEntity;
import org.qpcr.community.service.LogMessageServices;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

/**
 * 用户操作日志
 */
@RestController
@RequestMapping("/device/log")
@Authorize(ignore = true)
@Resource(id="device-log",name = "用户操作日志记录")
@Slf4j
@Tag(name = "用户操作日志记录")
@RequiredArgsConstructor
public class LogMessageController implements ReactiveServiceCrudController<LogMessageEntity, String> {

    @Getter
    private final LogMessageServices service;


    @PostMapping("/no-auth")
    @SaveAction
    @Operation(
        summary = "新增"
    )
    @Authorize(ignore = true)
    public  Mono<SaveResult> addOverride(@RequestBody Flux<LogMessageEntity> payload) {
        return  this.save(payload);
    }
}
